package cn.yyh.system.service.impl;

import cn.yyh.basic.service.impl.BaseServiceImpl;
import cn.yyh.system.domain.SystemDictionaryType;
import cn.yyh.system.mapper.SystemDictionaryDetailMapper;
import cn.yyh.system.mapper.SystemDictionaryTypeMapper;
import cn.yyh.system.service.ISystemDictionaryType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 杨永航
 * @version 1.0
 * @Title: SystemDictionaryTypeImpl
 * @Package: cn.yyh.system.service.impl
 * @date 2021/6/28
 */
@Service
public class SystemDictionaryTypeImpl extends BaseServiceImpl<SystemDictionaryTypeMapper, SystemDictionaryType> implements ISystemDictionaryType {
    @Autowired
    private SystemDictionaryDetailMapper detailMapper;

    @Override
    public void delete(Long id) {
        boolean flag = true;
        while (flag) {
            Boolean aBoolean = detailMapper.deleteAll(id);
            if (!aBoolean) {
                super.delete(id);
                flag = false;
            }
        }
    }

    @Override
    public void deleteBatch(List<Long> ids) {
        detailMapper.deleteBatch(ids);

        super.deleteBatch(ids);


    }
}
